flatten

fun <T> Try<Option<T>>.flatten(): Option<T>

Extracts an Option nested in the Try to a not nested Option.

Return

Option nested in a Success or None if this is a Failure.

fun <T> Option<Try<T>>.flatten(): Option<T>

Returns Some if this Some contains a Success. Otherwise returns None.

Return

Some if this Some contains a Success. Otherwise returns None.

fun <T> Option<Iterable<T>>.flatten(): List<T>

Returns nested List if this is Some. Otherwise returns an empty List.

Return

Nested List if this is Some. Otherwise returns an empty List.

fun <T> Iterable<Option<T>>.flatten(): List<T>

Returns List of values of each Some in this Iterable.

Return

List of values of each Some in this Iterable.

fun <T> Option<Option<T>>.flatten(): Option<T>

Transforms a nested Option to a not nested Option.

Return

Option nested in a Some or None if this option is empty.

fun <T> Try<Try<T>>.flatten(): Try<T>

Transforms a nested Try to a not nested Try.

Return

Try nested in a Success or this object if this is a Failure.